package com.zhangtong.excel;

import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class ExcelContext {
    int currentRowIdx;
    int currentDataRowIdx;
    XSSFWorkbook workbook;
    XSSFSheet currentSheet;
    CellStyle cellStyle;
    CellStyle titleStyle;

    public Row createNextRow() {
        Row row = currentSheet.createRow(getCurrentRowIdx());
        addCurrentRowIdx();
        return row;
    }

    public int getCurrentRowIdx() {
        return currentRowIdx;
    }

    public void addCurrentRowIdx() {
        this.currentRowIdx++;
    }

    public void addCurrentDataRowIdx() {
        this.currentDataRowIdx++;
    }

    public int getCurrentDataRowIdx() {
        return currentDataRowIdx;
    }

    public void setCurrentDataRowIdx(int currentDataRowIdx) {
        this.currentDataRowIdx = currentDataRowIdx;
    }

    public void setCurrentRowIdx(int currentRowIdx) {
        this.currentRowIdx = currentRowIdx;
    }

    public XSSFWorkbook getWorkbook() {
        return workbook;
    }

    public void setWorkbook(XSSFWorkbook workbook) {
        this.workbook = workbook;
    }

    public XSSFSheet getCurrentSheet() {
        return currentSheet;
    }

    public void setCurrentSheet(XSSFSheet currentSheet) {
        this.currentSheet = currentSheet;
    }

    public CellStyle getCellStyle() {
        return cellStyle;
    }

    public void setCellStyle(CellStyle cellStyle) {
        this.cellStyle = cellStyle;
    }

    public CellStyle getTitleStyle() {
        return titleStyle;
    }

    public void setTitleStyle(CellStyle titleStyle) {
        this.titleStyle = titleStyle;
    }
}
